#ifndef TESTENTITY_H_INCLUDED
#define TESTENTITY_H_INCLUDED

#include <Box2D/Box2D.h>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <vector>
#include "Animation.h"

enum EntityTypes{
    BOX,
    BALL,
    POLYGON,
    EDGE,
    EDGE_POLYGON
};


class TestEntity {

public:

    //constructors
    TestEntity();
    TestEntity(b2Vec2 verts[5], int ent_type);
    TestEntity(int type);
    TestEntity(int type, sf::Vector2f pos, sf::Vector2f dimensions, float rotation = 0);
    TestEntity(int type, sf::Vector2f pos, char* file, float scalar = 1.0, float rotation = 0);

    virtual ~TestEntity();

    sf::Clock eclock;

    b2Body* getBody();

    sf::Vector2f getWorldPosition();
    sf::Vector2i getPixelPosition();

    virtual void Update();
    void Render(sf::RenderWindow&);
    void Init();
    void impulseMove(b2Vec2);
    void forceMove(b2Vec2);
    void startContact() { m_numContacts++; }
    void endContact() { m_numContacts--; }
    void ToggleVisible();

    void setDimensions(float, float = 0);
    void setTxRect(sf::IntRect);
    void toggleAnimated();
    void setFrameRate(int);
    void toggleOscillate();
    bool checkContains(sf::Vector2f);
    void toggleSelected();
    bool getSelectedStatus();
    void setCurrentFrame(int);
    virtual void collisionResponse();

    int getType();
    bool doomed;



protected:

    b2Body* body;
    b2BodyDef bodyDef;
    b2PolygonShape b2Shape;
    b2CircleShape b2circle;
    b2FixtureDef FixtureDef;

    sf::CircleShape circ;
    sf::RectangleShape rect;
    sf::ConvexShape convex;

    sf::Texture texture;
    sf::Color entityColor;
    sf::Vector2f position;
    sf::Vector2f dimensions;
    sf::IntRect textureRect;

    sf::SoundBuffer buffer;
    sf::Sound sound;

    Animation eAnimation;

    bool visible;
    bool selected;
    bool animated;
    bool image;

    int type;
    int sides;
    int m_numContacts;

    float eScale;
    float radius;
    float angle;
    const float SCALE = 40;


};




#endif // TESTENTITY_H_INCLUDED
